{include file="header.html"}
<link href="{res file=css/egg.css}" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="{res file=js/egg.js}"></script>
<script type="text/javascript">
    $(document).ready(function() {
        //幻灯（奖品展示）
        $('#example2').bxCarousel({
            display_num: 1, //显示的内容数量
            move: 1, //一次移动几个内容
            auto: true, //加载页面后是否自动滚动
            controls: false, //是否添加控制元件
            margin: 10,
            auto_hover: true //鼠标放上时是否暂停
        });

        //change_egg
        $('#egg_type').change(function() {
            var egg_t = $(this).children('option:selected').val();   //弹出select的值
            if (egg_t != "0") {
                $('img[name="egg"]').each(function() {
                    this.src = "{res file=}images/egg/lock_" + egg_t + ".gif";
                });
            }
        });

    });
</script>

<div id="egg_index" class="w clearfix">
    <div class="main">
        <div class="login">
            <div class="side">
                <div class="dl">
                    <!--{if $visitor.user_id}-->
                    <div id="logined" style="display:block;"><a href="index.php?app=member&act=logout" style="cursor:hand;" class="logout">{$lang.member_logout}</a></div>
                    <!--{else}-->
                    <div id="unlogin" style="display:block" ><a href="index.php?app=member&act=login" class="login">{$lang.member_login}</a></div>
                    <!--{/if}-->
                    <input id="user_id" type="hidden" value="{$visitor.user_id}"/>
                </div>

                <div class="cl">
                    <form name=form1 action="" method=post marginWidth=0 marginHeight=0 frameBorder=0> 
                        <table width="278" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td width="105" height="30"><font color="#000000" style="font-size:13px;"><b>{$lang.choose_egg}</b></font></td>
                                <td>
                                    <select name="areaid" id="egg_type">
                                        <option value="0">{$lang.choose}</option>
                                        <option value="1">{$lang.gold_egg}</option>
                                        <option value="2">{$lang.silver_egg}</option>
                                        <option value="3">{$lang.copper_egg}</option>
                                    </select>
                                </td>
                                <td width="58"></td>
                            </tr>
                        </table>
                    </form>
                </div>
            </div>
            <div class="side_right">
            <div class="col-0" area="col-0" data-position="egg" widget_type="area">
                        <!--{widgets page=egg area=col-0}-->
                    </div>
            </div>
        </div>
        <div class="integral">
            <div class="zd">
                <div class="m">
                    <script>
                        function ex(t)
                        {
                            if ($('#user_id').val() == "0") {
                                alert("{$lang.login_please}");
                                return;
                            } else if ($('#egg_type').val() == "0") {
                                alert("{$lang.pls_select_egg}");
                                return;
                            } else if ($('#isex').val() == "0") {
                                alert("{$lang.pls_click_below_hitegg} ");
                                return;
                            } else {
                            }
                            var eggid = $('#egg_type').val();
                            //alert(""+eggid);
                            $.get('index.php?app=egg&act=eggact_ajax&ajax=1',
                                    {
                                        egg_type: function() {
                                            return $('#egg_type').val();
                                        }
                                    },
                            function(data) //回传函数  
                            {
                                $("#e" + t).children('img').attr("src", "{res file=}images/egg/ege_0" + eggid + ".gif");
                                $("#isex").val("0");
                                $("#goon").show();
                                alert(data);
                            }
                            );
                        }
                        function goonegg()
                        {
                            $("#isex").val("1");
                            $("#goon").hide();
                            var egg_t = $("#egg_type").children('option:selected').val();
                            $('img[name="egg"]').each(function() {
                                this.src = "{res file=}images/egg/lock_" + egg_t + ".gif";
                            });
                        }
                    </script>
                    <input id="isex" type="hidden" value="1"/>
                    <div class="d"><a class="da" id="e1" href="javascript:ex(1);"><img name="egg" src="{res file=images/egg/lock_1.gif}"/></a></div>
                    <div class="d"><a class="da" id="e2" href="javascript:ex(2);"><img name="egg" src="{res file=images/egg/lock_2.gif}"/></a></div>
                    <div class="d"><a class="da" id="e3" href="javascript:ex(3);"><img name="egg" src="{res file=images/egg/lock_3.gif}"/></a></div>
                </div>
                <div class="b b1" id="goon"><a href="javascript:goonegg()">{$lang.continue_hitegg}</a></div>
                <div class="b b2">{$lang.not_hit_continus}</div>
                <div class="b b3">{$lang.you_hit}<a> xjj </a>！</div>
            </div>
        </div> 
        <div class="clock">
            <div class="dk" style="position:relative">
                <div class="m1"><b>{$lang.award_record}</b></div>
                <div class="m2">
                    <table>
                        <!--{foreach from=$eggpresentrec_list item=eggpresentrec }-->
                        <tr>
                            <td align="left" width="80%">{$lang.congratulation_user} <a>{$eggpresentrec.username|truncate:9}</a> {$lang.hit_on} <a>{$eggpresentrec.presentname|escape}</a></td>
                            <td align="right" width="20%">{$eggpresentrec.add_time|date:m  d}</td>
                        </tr>
                        <!--{/foreach}-->
                    </table>
                </div>
                <div class="m3" style="position:relative;">
                    <b style="position:absolute;top:35%;left:35%">LOADING...</b>
                    <div class="examples_body">
                        <div class="bx_wrap">
                            <div class="bx_container">
                                <ul id="example2" style="position:relative">
                                    <!--{foreach from=$eggpresent_list item=eggpresent}-->
                                    <li><img height="160" width="240" src="{$eggpresent.eggpresent_logo}"></li>
                                    <!--{/foreach}-->
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>  
    </div>		   
</div>
{include file=server.html}
{include file="footer.html"}
